#include <iostream>

using namespace std;
int main(){
    int a,b,c,d;
    cin >> a >>b >> c >>d;
    if(d == 1){
        if(a > b && a > c){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else if(d == 2){
        if(b > a && b > c){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        if(c > a && c > b){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }        
    }
}
#include <iostream>
using namespace std;
int arr [200005];
int ans [200005];
int main(){
    int n;    cin >> n;
    long long tmp = 0;
    for(int i = 0;i < n;i++)    cin >> arr[i],tmp += arr[i];
    tmp = tmp / (n - 1);
    for(int i = 0;i < n;i++){
        cout << tmp - arr[i] << ' ';
    }
    return 0;
}
#include <iostream>
using namespace std;
long long arr[1000006];
void fun(){
    int n,q;    cin >> n >> q;
    for(int i = 1;i <= n;i++){
        cin >> arr[i];
    }
    int l,r;
    long long ans = 0;
    while(q--){
        cin >> l >> r;
        ans = arr[l];
        for(int i = l + 1;i <= r;i++){
            ans = (ans & arr[i]) << 1;
        }
        cout << ans << endl;
    }
}
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    int t;    cin >>t;
    while(t--){
        fun();
    }
}